<template>
  <div id="buttomEducation"></div>
</template>
<script setup lang="ts">
import { onMounted } from '@vue/runtime-core'
import * as Echarts from 'echarts'
import moment from 'moment'
import { fontSize } from '@/utils/tools'
const chartId = `${moment().valueOf()}`
const option = {
    color: ['#32CCB6', '#FFC800', '#FA611F', '#FF739D', '#CD57FF', '#575BFF'],
    title: {
      text: "管理层学历",
      left: "center",
      top:'',
      textStyle: {
        fontSize: fontSize(20)
      },
    },
    tooltip: {
        trigger: 'item',
        formatter: '{b}: {d}%'
    },
    series: [
      {
        name: '人员占比',
        type: 'pie',
        radius: ['40%', '60%'],
        left: 'center',
        avoidLabelOverlap: false,
        labelLine: {
          show: true,
          length: fontSize(10),
          length2: fontSize(35),
          fontSize: fontSize(20),
          maxSurfaceAngle: fontSize(80)
        },
        label: {
          formatter: '{a}:{d}%'
        },
        // labelLayout: function (params) {
        //     var isLeft = params.labelRect.x < myChart.getWidth() / 2;
        //     var points = params.labelLinePoints;
        //     // Update the end point.
        //     points[2][0] = isLeft
        //         ? params.labelRect.x
        //         : params.labelRect.x + params.labelRect.width;

        //     return {
        //         labelLinePoints: points,
        //         fontSize: 14
        //     };
        // },
        data: [
            {value: 128, name: '大学',},
            {value: 65, name: '初中',},
            {value: 21, name: '文盲',},
            {value: 87, name: '小学',},
            {value: 221, name: '硕士及以上'},
            {value: 400, name: '高中'},
        ]
      }
    ]
}
onMounted(() => {
  let myChart = Echarts.init(document.getElementById('buttomEducation'))
  myChart.setOption(option)
})
</script>
<style lang="less" scoped>
  .box {
  color: #60d659;
  }
</style>
